
package me.zhengjie.service;

import me.zhengjie.domain.AppWork;
import me.zhengjie.service.dto.AppWorkDto;
import me.zhengjie.service.dto.AppWorkQueryCriteria;
import org.springframework.data.domain.Pageable;
import org.springframework.transaction.annotation.Transactional;

import java.util.Map;
import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;

/**
* @website https://el-admin.vip
* @description 服务接口
* @author IQW
* @date 2022-07-03
**/
public interface AppWorkService {

    /**
    * 查询数据分页
    * @param criteria 条件
    * @param pageable 分页参数
    * @return Map<String,Object>
    */
    Map<String,Object> queryAll(AppWorkQueryCriteria criteria, Pageable pageable);

    Map<String,Object> queryAllApi(AppWorkQueryCriteria criteria, Pageable pageable);

    //查询紧急任务
    List<AppWorkDto> queryAllIndex(Integer userId);
    /**
    * 查询所有数据不分页
    * @param criteria 条件参数
    * @return List<AppWorkDto>
    */
    List<AppWorkDto> queryAll(AppWorkQueryCriteria criteria);

    Integer selectWorking(Integer userId);

    //查询未完成，未过期的任务数量
    Integer selUndoWorkCount(Integer userId);

    //查询已巡护任务次数
    Integer selWorkCount(Integer userId);

    //查问总里程
    float selWorkMilesSum(Integer userId);

    /**
     * 根据ID查询
     * @param workId ID
     * @return AppWorkDto
     */
    AppWorkDto findById(Integer workId);

    AppWork findOne(Integer workId);

    /**
    * 创建
    * @param resources /
    * @return AppWorkDto
    */
    AppWorkDto create(AppWork resources);

    /**
    * 编辑
    * @param resources /
    */
    void update(AppWork resources);

    @Transactional(rollbackFor = Exception.class)
    void updateStatus(Integer workId, Integer status,boolean isReset);

    Integer selWorkInt(Integer userId);

    /**
    * 多选删除
    * @param ids /
    */
    void deleteAll(Integer[] ids);

    /**
     * 检测并设置任务过期
     * @return
     */
    Boolean setWorkExp();

    /**
    * 导出数据
    * @param all 待导出的数据
    * @param response /
    * @throws IOException /
    */
    void download(List<AppWorkDto> all, HttpServletResponse response) throws IOException;
}